import Mock from 'mockjs';
 
// 定义一个模拟的 API 请求
Mock.mock(/\/api\/data/, 'get', function () {
    console.log('Mock intercepted!'); // 检查是否打印这条消息
    return {
        "data":[
            {
                "title": 'parent 1',
                "key": '0-0',
                "children": [
                    {
                        "title": 'parent 1-0',
                        "key": '0-0-0',
                        "children": [
                            { "title": 'leaf0', "key": '0-0-0-0','children':[] },
                            { "title": 'leaf1', "key": '0-0-0-1','children':[] },
                            { "title": 'leaf2', "key": '0-0-0-2','children':[] },
                        ],
                    },
                    {
                        "title": 'parent 1-1',
                        "key": '0-0-1',
                        "children": [{ "title": 'leaf3', "key": '0-0-1-0','children':[] }],
                    },
                    {
                        "title": 'parent 1-2',
                        "key": '0-0-2',
                        "children": [
                            { "title": 'leaf 4', "key": '0-0-2-0','children':[] },
                            {
                                "title": 'leaf 5',
                                "key": '0-0-2-1',
                                'children':[] 
                            },
                        ],
                    },
                    {
                        "title": 'parent 1-2',
                        "key": '0-0-3',
                        "children": [
                            { "title": 'leaf 6', "key": '0-0-3-0','children':[] },
                        ],
                    },
                ],
            },
            {
                "title": 'parent 2',
                "key": '0-1',
                "children": [
                    {
                        "title": 'parent 2-0',
                        "key": '0-1-0',
                        "children": [
                            { "title": 'leaf6', "key": '0-1-0-0','children':[] },
                            { "title": 'leaf7', "key": '0-1-0-1','children':[] },
                        ],
                    },
                ]
            }
        ]
    }
  });